//////////////////////////////////////////////////////////////////////////////////
//	 Copyright 2011 by Yosef Grabivker, ryuho@homenetworksoft.com
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//////////////////////////////////////////////////////////////////////////////////

#ifndef _LOG_VIEWER_YG_H__
#define _LOG_VIEWER_YG_H__

#include "def.h"
#include "logdataprovider.h"
#include "logctrl.h"
#include "searchimpl.h"

class CLogViewer: public wxDialog, public CLogDataProvider, public CSearchImpl<CLogViewer>
{
public:
								CLogViewer(class CGUILogic& logic);
	virtual						~CLogViewer(void);

	void						DataChanged();

	//ISearchProvider
	virtual void 				GetSearchFields(SEARCHFIELD*& sf, size_t& sz);
	virtual cSearchOwnerID		GetID()				{ return cSearchOwnerIDLog; }
	virtual void				OnFilterChanged();
	virtual bool				HasFilter() {return false;}

	void						OnContextMenu(long id, long col) {}

	bool						OnDropText(wxCoord x, wxCoord y, const wxString& data) { return false; }
	void						OnDragDropFinished( wxWindowID id, wxDragResult result) {}


protected:
	void						OnCloseBtn(wxCommandEvent& evnt);
	void						OnColumn(wxListEvent& ev);
	DECLARE_EVENT_TABLE()

private:
	void						DoSort();

private:
	class wxListCtrl*			m_pList;
	class CGUILogic&			m_logic;
	class CSearchPanel*			m_pSearch;
	unsigned int				m_nSortCol;
};

#endif //_LOG_VIEWER_YG_H__